package com.sup.member.service.impl;

import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sup.member.mapper.MemberTableMapper;
import com.sup.member.domain.MemberTable;
import com.sup.member.service.IMemberTableService;

@Service
public class MemberTableServiceImpl implements IMemberTableService
{
    @Autowired
    private MemberTableMapper memberTableMapper;

    @Override
    public MemberTable selectMemberTableByMemberId(Long memberId)
    {
        return memberTableMapper.selectMemberTableByMemberId(memberId);
    }

    @Override
    public List<MemberTable> selectMemberTableList(MemberTable memberTable)
    {
        return memberTableMapper.selectMemberTableList(memberTable);
    }

    @Override
    public int insertMemberTable(MemberTable memberTable)
    {
        // 设置默认会员等级为0
        memberTable.setMemberLevel("0");
        // 设置默认积分为0
        memberTable.setMemberPoints(0L);
        // 设置注册时间为当前时间
        memberTable.setMemberRegistrationTime(new Date());
        // 设置修改时间为当前时间
        memberTable.setMemberModificationTime(new Date());
        return memberTableMapper.insertMemberTable(memberTable);
    }

    @Override
    public int updateMemberTable(MemberTable memberTable)
    {
        return memberTableMapper.updateMemberTable(memberTable);
    }

    @Override
    public int deleteMemberTableByMemberIds(Long[] memberIds)
    {
        return memberTableMapper.deleteMemberTableByMemberIds(memberIds);
    }

    @Override
    public int deleteMemberTableByMemberId(Long memberId)
    {
        return memberTableMapper.deleteMemberTableByMemberId(memberId);
    }
}